package com.zheng.service.impl;

import com.zheng.entity.CompanyFinanceBillValidateRecord;
import com.zheng.mapper.CompanyFinanceBillValidateRecordMapper;
import com.zheng.service.CompanyFinanceBillValidateRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * @version 1.0
 * @Copyright (c) 合思技术团队 https://www.hosecloud.com/
 * @Package com.zheng.service.impl
 * @Project：trans_demo
 * @authur：zhengtianliang@hosecloud.com
 * @date：2025/4/8 17:01
 */

@Service
public class CompanyFinanceBillValidateRecordImpl implements CompanyFinanceBillValidateRecordService {
    @Autowired
    private CompanyFinanceBillValidateRecordMapper mapper;

    @Override
    @Transactional
    public int batchSave(List<CompanyFinanceBillValidateRecord> list,Integer i) {
        try {
            if (i==1){
                throw new RuntimeException("123");
            }
            int i1 = mapper.batchSave(list);
        }catch (Exception e){
            System.out.println("error start ");
            CompanyFinanceBillValidateRecord companyFinanceBillValidateRecord = list.get(0);

            List<CompanyFinanceBillValidateRecord> list1 = new ArrayList<>();
            companyFinanceBillValidateRecord.setValidateName("error");
            list1.add(companyFinanceBillValidateRecord);
            mapper.batchSave(list);
        }

        return 1;
    }
}
